<template>
  <el-card class="w-full pt-[5px] mt-[10px]" 
  style="min-height:98%">
    <div class="mb-[20px] text-right">
      <el-button type="primary" @click="addModelVisible = !true">
        <el-icon class="mr-[5px]"><Plus /></el-icon>
        新增方案
      </el-button>
    </div>
    <el-table :data="tableData" class="w-full" stripe row-key="id">
      <!-- <el-table-column type="selection" width="55" /> -->
      <el-table-column type="index" width="50" label="序号" />
      <el-table-column prop="name" label="方案名称" >
        <template #default="{ row,$index }">
          <el-button type="primary" link size="small" plain @click="handlePzfa(row,$index)">
            {{ row.name }}
          </el-button>
        </template>
      </el-table-column>
      <el-table-column prop="type" label="分类" />
      <el-table-column prop="year" label="考核年份" />
      <el-table-column prop="date" label="申请起止时间" />
      <el-table-column prop="state" label="状态" />
      <el-table-column prop="examiner" label="考核人员" >
        <template #default="{ row,$index }">
          <el-button type="primary" link size="small" plain @click="handlePzry(row,$index)">
            {{ row.examiner }}
          </el-button>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="方案配置" width="260" align="center">
        <template #default="scope">
          <el-button type="primary" size="small" plain @click="handlePzfa(scope.row,scope.$index)">
            配置方案
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="mt-[20px] flex justify-end">
      <el-pagination
        v-bind="pagination"
        @update:current-page="currentChange"
        @update:page-size="sizeChange"
      />
    </div>
  </el-card>
  <AddModel v-model="addModelVisible" />
</template>

<script setup>
import { getToken } from "@/utils/auth";
import useAppStore from '@/store/modules/app'
import usePagination from "@/hooks/pagination";
import useOperate from "@/hooks/operate";
import AddModel from "./components/AddMd.vue";

const router = useRouter();
const appStore = useAppStore()
const { proxy } = getCurrentInstance();
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");

const addModelVisible = ref(false);
const searchForm = ref({});
const { pagination, currentChange, sizeChange } = usePagination();
const { handleDelete } = useOperate();
pagination.total = 10;
const tableData = ref([
  {
    name: "成都大学2024年度科研考核方案",
    type: "科研考试",
    year: "2024年",
    date: "2025-01-02-2025-05-22",
    state: "已完成",
    examiner: "5",
  },
  {
    name: "成都大学2024年度科研考核方案",
    type: "科研考试",
    year: "2024年",
    date: "2025-01-02-2025-05-22",
    state: "已完成",
    examiner: "3",
  },
  {
    name: "成都大学2024年度科研考核方案",
    type: "科研考试",
    year: "2024年",
    date: "2025-01-02-2025-05-22",
    state: "已完成",
    examiner: "1021 （1021）",
  },
]);
//点击编辑
const handlePzfa = (row, index=1) => {
  router.push("/examine/khfa/"+ (index+1))
};
const handlePzry = (row, index=1) => {
  router.push("/examine/khry/"+ (index+1))
};
//点击删除
const handleDel = () => {
  handleDelete();
};
</script>

<style scoped lang="scss"></style>

